{
  //声明变量
  //布尔类型 『类型注解』『类型声明』
  let b: boolean; //声明一个布尔类型的变量
  b = true;
  b = false;
  // b = '100';  //不能将类型“string”分配给类型“boolean”
  // b = 100
  //声明变量并赋初始值
  let b2: boolean = true;

  //数字类型
  let n: number;
  n = 100;
  n = 0b1010;
  n = 0o777;
  n = 0x23;
  // console.log(n);
  // n = '100';//不能将类型“string”分配给类型“number”
  // n = false;
  let n2: number = 200;

  //字符串类型
  let s: string;
  s = "i miss you";
  s = "i like you";
  s = `i want you`;
  let s2: string = "hello";
  // s = 200; //不能将类型“number”分配给类型“string”。

  //字面量值类型
  let x: "love"; // x 为 love 类型的变量
  x = "love";

  //联合类型
  let x2: "male" | "female" | "secret";
  x2 = "male";

  let float: "left" | "right";
  float = "left";

  // any 类型. any 任意. 原则:  any 能不用就不用, 实在没招再用
  let a: any;
  a = 100;
  a = "200";
  a = true;
  a = {};

  // void 类型. 空类型
  // let v: void;
  // v = undefined;
  // v = 100;
  // v = 'abc';
  // v = null;

  //表明 fn 函数返回值为空.
  // function fn():void{
  // }

  //never 从不
  // 表明该函数没有返回, 永远都没有返回值
  function fn(): never {
    //1. 死循环
    // while(true){
    //   console.log('run run run');
    // }
    //2. 抛出错误
    throw new Error("出问题啦~~");
  }

  //对象类型  object 用的较少
  let o: object;
  o = {};
  o = { a: 100 };
  o = [];
  o = function () {};
  // o = 100;
  //声明时直接赋值初始值
  let o2: object = {};

  //array 数组类型. 数组中的每个元素类型必须保持一致
  let arr: string[]; //arr 是字符串数组
  arr = ["1", "2", "3", "4"];
  arr.push("5");

  let arr2: Array<number>; //arr2 是一个数字的数组
  arr2 = [254, 684];

  //元组
  let info: [string, number];
  info = ["小杨哥", 2323];

  //测试
  let test: [string, number][];
  test = [
    ["张三", 28],
    ["李四", 27],
    ["王五", 68],
  ];
  test[0][0];

  //枚举类型  enum => object.create  object.defineProperty
  enum Gender {
    female = "f",
    male = "m",
    secret = "s",
  }

  let g = Gender.female;
  let g2 = Gender.male;

  console.log(g);
}
